<?php

namespace App\Libraries\Contracts;

use Prettus\Repository\Contracts\RepositoryCriteriaInterface;
use Prettus\Repository\Contracts\RepositoryInterface;

interface IBaseRepository extends RepositoryInterface, RepositoryCriteriaInterface
{
    /**
     * 统计数量.
     *
     * @param array $columns
     *
     * @return mixed
     */
    public function counts(array $columns = ['*']);

    /**
     * 获取树形列表.
     *
     * @param $field
     * @param null $pid
     * @param $level
     * @param $lazy
     * @param $columns
     *
     * @return mixed
     */
    public function children($field, $pid, $level, $lazy, $columns);

    /**
     * 求某个字段之和.
     *
     * @param string $column
     *
     * @return mixed
     */
    public function sum($column = 'id');

    /**
     * Increment a column's value by a given amount.
     *
     * @param string $column
     * @param int    $id
     * @param int    $amount
     *
     * @return mixed
     */
    public function increment($column, $id, $amount = 1);

    /**
     * Decrement a column's value by a given amount.
     *
     * @param string $column
     * @param int    $id
     * @param int    $amount
     *
     * @return mixed
     */
    public function decrement($column, $id, $amount = 1);
}
